import {Result} from "@/model";
import request from "@/utils/request";
import {AxiosPromise} from "axios";
import {QuizTag, RecordTag} from "./types";
import {RecordConditionList} from "../record/types";
import {QuizConditionList} from "../quiz/types";

/**
 * 查看记录标签
 * @returns 记录标签
 */
export function getRecordTagList(): AxiosPromise<Result<RecordTag[]>> {
    return request({
        url: "/tag/record/list",
        method: "get",
    });
}

/**
 * 查看指定标签下的记录
 * @returns 记录列表
 */
export function getTagRecordList(params: number[]): AxiosPromise<Result<RecordConditionList>> {
    return request({
        url: "/tag/record",
        method: "get",
        params,
    });
}

/**
 * 查看题目标签
 * @returns 题目标签
 */
export function getQuizTagList(): AxiosPromise<Result<QuizTag[]>> {
    return request({
        url: "/tag/quiz/list",
        method: "get",
    });
}

/**
 * 查看指定标签下的题目
 * @returns 题目列表
 */
export function getTagQuizList(params: number[]): AxiosPromise<Result<QuizConditionList>> {
    return request({
        url: "/tag/quiz",
        method: "get",
        params,
    });
}
